<%= render 'spree/admin/shared/error_messages', target: address %>
<%= render 'spree/addresses/form',
                  address_name: 'address',
                  address_form: f,
                  address_type: 'shipping',
                  address: address %>
<% if @order.user.present? && @order.user.addresses.many? %>
  <div>
    <div class="w-100 text-center mb-2"><%= Spree.t(:or_select_other_address) %></div>
    <%= label_tag :shipping_address_id, Spree.t(:existing_address), class: "sr-only" %>
    <%= tom_select_tag :shipping_address_id, {include_blank: Spree.t(:existing_address), class: "mb-2", options: @order.user.addresses.map { |a| {id: a.id, name: a.to_s.gsub('<br/>', ", ")}}.as_json, select_data: {action: 'auto-submit#submit'} }  %>
  </div>
<% end %>
